﻿#include <Sys\RenderUnit\SysRenderDatagram\ANCHORRD.HPP>
#include <Render\Render_Win32\Render_Win32_D3D\RENDER_WIN32_D3D9.HPP>
#include <Sys\RenderUnit\SYSDDCLASSID.HPP>
#include <d3dx9.h>

using namespace CxxlMan;
using namespace Cxxl3D;


class CAnchorDD_D3D:public IDatagramDisposal_D3d9
{

  virtual bool cxxlFASTCALL Exec(const Smart_Ptr<IRenderDatagramDisposalCenterD3d> &IRenderDatagramDisposalCenterD3d_Arg,
    const Smart_Ptr<IRenderDatagram> &IRenderDatagram_Arg, LPDIRECT3DDEVICE9 pDEVICE9)
  {
    Smart_Ptr<IAnchorRD> IAnchorRD_Ptr = (IAnchorRD*)GetDefaultInterface(IRenderDatagram_Arg);
    Smart_Ptr<IC3D_Node> IC3D_Node_Ptr = IAnchorRD_Ptr->Get_IC3D_Node();
    CSmart_Ptr<const Matrix4x4> WorldMatrix_cPtr = IC3D_Node_Ptr->GetWorldMatrix();
    pDEVICE9->SetTransform(D3DTS_WORLD, (D3DXMATRIX*)(const Matrix4x4*)WorldMatrix_cPtr); // Set world matrix

    return true;
  }

public:

  // Constructor
  CAnchorDD_D3D()
    :cxxlObject(Spirit_Easy)
  {
  }

  // Destructor
  virtual ~CAnchorDD_D3D()
  {
  }

};


cxxlObject *cxxlFASTCALL New_CAnchorDD_D3D9()
{
  return new CAnchorDD_D3D;
}